/**
  ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFTOFWall
  \brief TOF Wall class. Just a container for holding hits.
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-10-29
  \date 2021-10-29 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-10-29   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFTOFWall_h
#define ETFTOFWall_h

#include <map>
#include "ETFDetector.h"

using std::map;

class TClonesArray;
class ETFHPTDCChannel;
class ETFPlaHit;
class ETFTrack;

class ETFTOFWall : public ETFDetector{
public:
  ETFTOFWall(){}
  ETFTOFWall(const char *name);
  virtual ~ETFTOFWall();

  virtual void Initialize(); ///< initialize the detector
  virtual void Assign(const ETFHPTDCChannel *ch); ///< add the data channel to the detector
  /// assign drift time start and fired strip id to DC hits during tracking processes
  virtual bool AssignDriftTimeStart(ETFTrack *trk);
  virtual void ConstructGraph(); ///< add strip to fGDumb
  virtual void Register(); ///< register hits to the main output tree

  ETFPlaHit *GetStrip(int id); ///< get fired strip by serial id
  virtual int GetNFiredStrip() const; ///< number of valid fired strips
  virtual void Print(); ///< print the detector info
  virtual void DrawHits(); ///< draw the hits

  ClassDef(ETFTOFWall, 1);

protected:
  /// \param stripId: 0-30, along x increasing direction
  /// \param udvh: 0-1-2-3: uv, uh, dv, dh
  virtual void AddHit(const ETFHPTDCChannel *ch, int stripId, int udvh);

  double WIDTH; ///< width of plastic scintillator strip in mm
  TClonesArray *fHits; //-> ///< an array of plastic strips
  map<int, int> fStripIdMap; ///< map<id, index_in_fHits>, just for strip retrieval by id
  map<int, double> fDelayStr; ///< <stripId, delay> delay constants for each specific strip
  int NS; ///< number of strips
};

#endif
